package leetcode.二叉树;

public class 相同的树100 {

    public static boolean isSameTree(TreeNode p, TreeNode q) {
        return process(p,q);

    }

    public static boolean process(TreeNode p,TreeNode q){
        if(p == null && q==null) {
            return true;
        }
        if(p== null || q==null){
            return false;
        }
        if(p.val != q.val){
            return false;
        }
        return process(p.left,q.left) && process(p.right,q.right);
    }


}
